package org.barad.architecture.analyzer.widgets;

import javax.swing.tree.DefaultMutableTreeNode;

public class CustomMutableTreeNode extends DefaultMutableTreeNode {
	public static final long serialVersionUID = 1L;
	private String name;
	
	public CustomMutableTreeNode(String name, Object userObject) {
		super(userObject);
		this.name = name;
	}
	
	@Override 
	public String toString() {
		return name;
	}

	@Override
	public void setUserObject(Object userObject) {
		if (userObject != null && userObject.getClass().getCanonicalName().equals("java.lang.String")) {
			name = (String)userObject;
		}
		super.setUserObject(userObject);
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
